﻿using Cassandra;
using IDAdmin.Lib.Utils;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Globalization;
using System.Linq;
using System.Text;

namespace IDAdmin.Lib.DataLayer
{
    public class PremiumLoginWebDB
    {
        List<string> gameServerList;// = new List<string>() { "vn03","vn04" };
        List<FilledCard> filledCardDt = new List<FilledCard>();
        List<string> accountAtSeventhDayT = new List<string>();
        public PremiumLoginWebDB()
        {
            gameServerList = WebDB_N.ListServer().Select(s => s.tablezone).ToList();
        }

        public string getInventoryAccountSum(DateTime date)
        {
            string inventoryAccountSum = "";
            try
            {
                using (SqlConnection conn = ConnectionHelper.GetConnection())
                {
                    SqlCommand command = new SqlCommand();
                    command.CommandTimeout = 3600;
                    command.CommandType = CommandType.Text;
                    command.Connection = conn;
                    string commandText = "Select count(distinct(account)) as amount from au where adatetime <= '{0}'";
                    commandText = string.Format(commandText, date.ToString("yyyy-MM-dd") + " 23:59:59");
                    command.CommandText = commandText;
                    object result = command.ExecuteScalar();
                    if (result != null)
                    {
                        inventoryAccountSum = result.ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return inventoryAccountSum;
        }
        public string getActiveSpendAccountNum(DateTime date)
        {
            string activeSpendAccountNum = "";
            DateTime firstDate = new DateTime(date.Year, date.Month, 1);
            try
            {
                using (SqlConnection conn = ConnectionHelper.GetConnection())
                {
                    SqlCommand command = new SqlCommand();
                    command.CommandTimeout = 3600;
                    command.CommandType = CommandType.Text;
                    command.Connection = conn;
                    string commandText = "Select count(distinct(account)) as amount from FilledCard where filltime between '{0}' and '{1}'";
                    commandText = string.Format(commandText, firstDate.ToString("yyyy-MM-dd") + " 00:00:00", date.ToString("yyyy-MM-dd") + " 23:59:59");
                    command.CommandText = commandText;
                    object result = command.ExecuteScalar();
                    if (result != null)
                    {
                        activeSpendAccountNum = result.ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return activeSpendAccountNum;
        }

        public string getInventoryGoldNum(DateTime date)
        {
            string goldSave = "";
            try
            {
                using (SqlConnection connection = ConnectionHelper.GetConnection())
                {
                    SqlCommand cmd = new SqlCommand("SELECT goldsave FROM GoldSave" + " WHERE datetime between " + "'" + date.ToString("yyyy-MM-dd ") + "00:00:00'" + " and " + "'" + date.ToString("yyyy-MM-dd ") + "23:59:59'", connection);
                    cmd.CommandTimeout = 3600;
                    object result = cmd.ExecuteScalar();
                    if (result != null)
                    {
                        goldSave = result.ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return goldSave;
        }

        public string getInventoryScoreCardNum(DateTime date)
        {
            string pointSave = "";
            try
            {
                using (SqlConnection connection = ConnectionHelper.GetConnection())
                {
                    SqlCommand cmd = new SqlCommand("SELECT pointsave FROM ScoredCardSave" + " WHERE datetime between " + "'" + date.ToString("yyyy-MM-dd ") + "00:00:00'" + " and " + "'" + date.ToString("yyyy-MM-dd ") + "23:59:59'", connection);
                    cmd.CommandTimeout = 3600;
                    object result = cmd.ExecuteScalar();
                    if (result != null)
                    {
                        pointSave = result.ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return pointSave;
        }

        public string getUsingGoldNum(DateTime date)
        {
            int usingGoldNum = 0;
            try
            {
                using (SqlConnection connection = ConnectionHelper.GetConnection())
                {
                    foreach (string gameServer in gameServerList)
                    {

                        SqlCommand cmd = new SqlCommand("SELECT sum(changes) as amount FROM goldshop" + gameServer + " WHERE objname = 'Vàng' and baseid=65534 and type=0 " + " and datetime between '" + date.ToString("yyyy-MM-dd") + " 00:00:00' AND '" + date.ToString("yyyy-MM-dd") + " 23:59:59'", connection);
                        cmd.CommandTimeout = 3600;
                        object result = cmd.ExecuteScalar();
                        if (result != null)
                        {
                            if (DataToolUtil.IsNumeric(result.ToString()))
                            {
                                usingGoldNum += int.Parse(result.ToString());
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return usingGoldNum.ToString();
        }

        public string getRechardSum(DateTime date)
        {
            string rechardNum = "";
            try
            {
                using (SqlConnection conn = ConnectionHelper.GetConnection())
                {
                    SqlCommand command = new SqlCommand();
                    command.CommandTimeout = 3600;
                    command.CommandType = CommandType.Text;
                    command.Connection = conn;
                    string commandText = "Select sum(point) as amount from FilledCard where filltime between '{0}' and '{1}'";
                    commandText = string.Format(commandText, date.ToString("yyyy-MM-dd") + " 00:00:00", date.ToString("yyyy-MM-dd") + " 23:59:59");
                    command.CommandText = commandText;
                    object result = command.ExecuteScalar();
                    if (result != null)
                    {
                        rechardNum = result.ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return rechardNum;
        }

        public string getRechardSumGOSU(DateTime date)
        {
            string rechardNum = "";
            try
            {
                using (SqlConnection conn = ConnectionHelper.GetConnection())
                {
                    float result = 0;
                    SqlCommand command = new SqlCommand();
                    command.CommandTimeout = 3600;
                    command.CommandType = CommandType.Text;
                    command.Connection = conn;
                    string commandText = "Select point from FilledCard where filltime between '{0}' and '{1}'";
                    commandText = string.Format(commandText, date.ToString("yyyy-MM-dd") + " 00:00:00", date.ToString("yyyy-MM-dd") + " 23:59:59");
                    command.CommandText = commandText;
                    SqlDataReader dataReader = command.ExecuteReader();
                    while (dataReader.Read())
                    {                     
                        result += FilledCardWebDB.getRation(Convert.ToInt32(dataReader["point"]));
                    }
                    rechardNum = result.ToString();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return rechardNum;
        }

        public string getGosu(DateTime date)
        {
            string rechardNum = "";
            float result = 0;
            string Cql = "select * from gh_stats.filledcard where type=0 and filltime >='{0}' and filltime <='{1}' ALLOW FILTERING;";

            string query = String.Format(Cql, Convert.ToDateTime(date.ToString("yyyy-MM-dd 00:00:00")).AddHours(-7).ToString("yyyy-MM-dd HH:mm:ss"), Convert.ToDateTime(date.ToString("yyyy-MM-dd 23:59:59")).AddHours(-7).ToString("yyyy-MM-dd HH:mm:ss"));
                    ISession localSession = ConnectionHelper.getConnectionForCasGhStats();
                    PreparedStatement state = localSession.Prepare(query);
                    BoundStatement boundStatement = new BoundStatement(state);
                    RowSet r = localSession.Execute(boundStatement);
                    if (r != null)
                    {
                        foreach (Row row in r.GetRows())
                        {
                            result += FilledCardWebDB.getRation(Convert.ToInt32(row.GetValue<long>("point")));
                        }                        
                    }
                    rechardNum = result.ToString();
                    localSession.Cluster.Shutdown();
                    return rechardNum;
        }

        public string getGoldExchangeFromScoredCardData(DateTime date)
        {
            int goldSumExchangeFromScoredCard = 0;
            try
            {
                using (SqlConnection connection = ConnectionHelper.GetConnection())
                {
                    foreach (string gameServer in gameServerList)
                    {
                        SqlCommand cmd = new SqlCommand("SELECT sum(changes) as amount from goldshop" + gameServer + " WHERE objname = 'Vàng' and srcid =0 and baseid=65534 and tmpInfo= '-' and type=1 and (action=N'Nhấp Thẻ Đổi Vàng' or action = N'㿨ҽ' or action=N'Nap The Doi Vang')" + " and datetime between '" + date.ToString("yyyy-MM-dd") + " 00:00:00' AND '" + date.ToString("yyyy-MM-dd") + " 23:59:59'", connection);
                        cmd.CommandTimeout = 3600;
                        cmd.CommandType = CommandType.Text;
                        object result = cmd.ExecuteScalar();
                        if (result != null && DataToolUtil.IsNumeric(result.ToString()))
                        {
                            goldSumExchangeFromScoredCard += int.Parse(result.ToString());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return goldSumExchangeFromScoredCard.ToString();
        }

        public string getRechardAccountNum(DateTime date)
        {
            string rechardAccountNum = "";
            try
            {
                using (SqlConnection conn = ConnectionHelper.GetConnection())
                {
                    SqlCommand command = new SqlCommand();
                    command.CommandTimeout = 3600;
                    command.CommandType = CommandType.Text;
                    command.Connection = conn;
                    string commandText = "Select count(distinct(account) ) as amount from FilledCard where filltime between '{0}' and '{1}'";
                    commandText = string.Format(commandText, date.ToString("yyyy-MM-dd") + " 00:00:00", date.ToString("yyyy-MM-dd") + " 23:59:59");
                    command.CommandText = commandText;
                    object result = command.ExecuteScalar();
                    if (result != null)
                    {
                        rechardAccountNum = result.ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return rechardAccountNum;
        }

        public string getNewIncreaseRechardAccountNum(DateTime date)
        {
            var filledCardAtTime = new[] { new { account = "" } }.ToList();
            filledCardAtTime.RemoveAt(0);
            List<FilledCard> filledCardData = new List<FilledCard>();

            string NewIncreaseRechardAccountNum = "";
            try
            {
                using (SqlConnection conn = ConnectionHelper.GetConnection())
                {
                    SqlCommand command = new SqlCommand();
                    command.CommandTimeout = 3600;
                    command.CommandType = CommandType.Text;
                    command.Connection = conn;
                    string commandText = "Select distinct(account)  as account from FilledCard where filltime between '{0}' and '{1}'";
                    commandText = string.Format(commandText, date.ToString("yyyy-MM-dd") + " 00:00:00", date.ToString("yyyy-MM-dd") + " 23:59:59");
                    command.CommandText = commandText;
                    SqlDataReader dataReader = command.ExecuteReader();
                    while (dataReader.Read())
                    {
                        string account = dataReader.GetString(0).ToLower();
                        filledCardAtTime.Add(new { account = account });
                    }
                    dataReader.Close();
                    string cmdText = "SELECT filltime,account FROM FilledCard WHERE filltime >= " + "'" + "2015-03-12" + " 00:00:00'" + " and filltime <= " + "'" + date.ToString("yyyy-MM-dd") + " 23:59:59'";
                    command.CommandText = cmdText;
                    SqlDataReader drReader = command.ExecuteReader();
                    while (drReader.Read())
                    {
                        FilledCard fc = new FilledCard();
                        fc.FILLTIMESTR = drReader.GetDateTime(0).ToString("dd/MM/yyyy");
                        fc.FILLTIME = DateTime.ParseExact(fc.FILLTIMESTR, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                        fc.ORIGIONFILLTIME = drReader.GetDateTime(0);
                        fc.ACCOUNT = drReader.GetString(1).ToLower();
                        filledCardData.Add(fc);
                    }
                    filledCardDt = filledCardData;
                    drReader.Close();
                }
                date = DateTime.ParseExact(date.ToString("dd/MM/yyyy"), "dd/MM/yyyy", CultureInfo.InvariantCulture);
                int sum = 0;
                foreach (var account in filledCardAtTime)
                {
                    int count = filledCardData.Where(w => w.FILLTIME.CompareTo(date) < 0 && w.ACCOUNT.ToLower().Equals(account.account.ToLower())).Count();
                    if (count <= 0)
                    {
                        sum++;
                    }
                }
                NewIncreaseRechardAccountNum = sum.ToString();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return NewIncreaseRechardAccountNum;
        }

        public string getUsingCharacterNum(DateTime date)
        {
            int usingCharacterNum = 0;
            try
            {

                using (SqlConnection connection = ConnectionHelper.GetConnection())
                {
                    foreach (string gameServer in gameServerList)
                    {

                        SqlCommand cmd = new SqlCommand();
                        cmd.CommandTimeout = 3600;
                        cmd.Connection = connection;
                        string cmdText="select count(distinct(dstid)) from goldshop{0} where type=1  and objname NOT IN (N'Gia Tộc Trợ Lệnh',N'Gia Tộc Lệnh',N'Lăng Ba Phù',N'Khinh Công Phù',N'Hồi Thành Quyển') and  action='buy_npc' and tmpInfo=N'Tiệm Tùy Thân' and datetime between '{1}' AND '{2}'";
                        cmd.CommandText = string.Format(cmdText, gameServer, date.ToString("yyyy-MM-dd") + " 00:00:00", date.ToString("yyyy-MM-dd") + " 23:59:59");
                        //cmd.CommandText = "SELECT count(dstid) as amount FROM goldshop" + gameServer + " WHERE action = 'buy_npc' and type=1" + " and datetime between '" + date.ToString("yyyy-MM-dd") + " 00:00:00' AND '" + date.ToString("yyyy-MM-dd") + " 23:59:59'";
                        object result = cmd.ExecuteScalar();
                        if (result != null && DataToolUtil.IsNumeric(result.ToString()))
                        {
                            usingCharacterNum += int.Parse(result.ToString());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return usingCharacterNum.ToString();
        }

        public string getRechardAccountSum(DateTime date)
        {
            date = DateTime.ParseExact(date.ToString("dd/MM/yyyy"), "dd/MM/yyyy", CultureInfo.InvariantCulture);
            string RechardAccountSum = filledCardDt.Where(w => w.FILLTIME.CompareTo(date) <= 0).Select(s => s.ACCOUNT.ToLower()).Distinct().Count().ToString();
            return RechardAccountSum;
        }

        public void getSevenDaySaveAccountNum(DateTime date, out string sevenDaySaveAccountNum, out string savePercent)
        {
            sevenDaySaveAccountNum = "";
            savePercent = "";
            TimeSpan difference = DateTime.Now.Date - date.Date;
            int days = (int)difference.TotalDays;
            if (days >= 8)
            {
                //var accountAtPresentTime = new[] { new { account = "" } }.ToList();
                /// accountAtPresentTime.RemoveAt(0);
                List<string> accountAtPresentTime = new List<string>();
                //var accountAtSeventhDayTime = new[] { new { account = "" } }.ToList();
                // accountAtSeventhDayTime.RemoveAt(0);
                List<string> accountAtEighthDayTime = new List<string>();

                using (SqlConnection conn = ConnectionHelper.GetConnection())
                {
                    double fromTS = DataToolUtil.kindDateTimeToKindUnixTimestamp(DateTime.ParseExact(date.ToString("yyyy-MM-dd") + " 00:00:00", "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture), DateTimeKind.Local);
                    double toTS = DataToolUtil.kindDateTimeToKindUnixTimestamp(DateTime.ParseExact(date.ToString("yyyy-MM-dd") + " 23:59:59", "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture), DateTimeKind.Local);
                    string cmdText = "Select distinct(account)   as account from au where timestamp >= {0} and timestamp <={1}";
                    cmdText = string.Format(cmdText, fromTS, toTS);
                    SqlCommand command = new SqlCommand(cmdText, conn);
                    command.CommandTimeout = 3600;
                    SqlDataReader dataReader = command.ExecuteReader();
                    while (dataReader.Read())
                    {
                        accountAtPresentTime.Add(dataReader.GetString(0).ToLower());
                    }
                    dataReader.Close();
                }

                using (SqlConnection conn = ConnectionHelper.GetConnection())
                {
                    DateTime atEightDay = date.AddDays(7);
                    double fromTS = DataToolUtil.kindDateTimeToKindUnixTimestamp(DateTime.ParseExact(atEightDay.ToString("yyyy-MM-dd") + " 00:00:00", "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture), DateTimeKind.Local);
                    double toTS = DataToolUtil.kindDateTimeToKindUnixTimestamp(DateTime.ParseExact(atEightDay.ToString("yyyy-MM-dd") + " 23:59:59", "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture), DateTimeKind.Local);
                    string cmdText = "Select distinct(account) as account from au where timestamp >= {0} and timestamp <={1}";
                    cmdText = string.Format(cmdText, fromTS, toTS);
                    SqlCommand command = new SqlCommand(cmdText, conn);
                    command.CommandTimeout = 3600;
                    SqlDataReader dataReader = command.ExecuteReader();
                    while (dataReader.Read())
                    {
                        accountAtEighthDayTime.Add(dataReader.GetString(0).ToLower());
                    }
                    dataReader.Close();
                    accountAtSeventhDayT = accountAtEighthDayTime;
                }
                int num = 0;

                foreach (var account in accountAtPresentTime)
                {
                    string count = accountAtEighthDayTime.Where(w => w.ToLower().Equals(account.ToLower())).Select(s => s).FirstOrDefault();
                    if (count != null)
                    {
                        num++;
                    }
                }
                sevenDaySaveAccountNum = num.ToString();

                if (accountAtPresentTime.Count() != 0)
                {
                    savePercent = ((double)(num * 100) / (double)accountAtPresentTime.Count()).ToString("0.00") + "%";
                }
            }
        }

        public void getNewIncreaseAccountLossSum(DateTime date, out string newIncreaseAccountLossSum, out string newIncreaseAccountLossPercent)
        {
            newIncreaseAccountLossSum = "";
            newIncreaseAccountLossPercent = "";
            TimeSpan difference = DateTime.Now.Date - date.Date;
            int days = (int)difference.TotalDays;
            if (days >= 8)
            {
                List<string> nauList = new List<string>();
                using (SqlConnection connection = ConnectionHelper.GetConnection())
                {
                    string commandText = "select DISTINCT(account) as account  from nau where datetime between '{0}' and '{1}'";
                    commandText = string.Format(commandText, date.ToString("yyyy-MM-dd") + " 00:00:00", date.ToString("yyyy-MM-dd") + " 23:59:59");
                    SqlCommand cmd = new SqlCommand(commandText, connection);
                    cmd.CommandTimeout = 3600;
                    SqlDataReader dataReader = cmd.ExecuteReader();
                    while (dataReader.Read())
                    {
                        nauList.Add(dataReader["account"].ToString().ToLower());
                    }
                    dataReader.Close();
                }

                int NewIncreaseAccountLossSum = 0;
                foreach (var account in nauList)
                {
                    string count = accountAtSeventhDayT.Where(w => w.ToLower().Equals(account.ToLower())).Select(s => s).FirstOrDefault();
                    if (count == null)
                    {
                        NewIncreaseAccountLossSum++;
                    }
                }
                newIncreaseAccountLossSum = NewIncreaseAccountLossSum.ToString();
                if (nauList.Count() != 0)
                {
                    newIncreaseAccountLossPercent = ((double)(NewIncreaseAccountLossSum * 100) / (double)nauList.Count()).ToString("0.00") + "%";
                }
            }
        }

        public void insertPremiumLogin(List<PremiumLogin> data, List<DateTime> dateTimeList)
        {
            using (SqlConnection conn = ConnectionHelper.GetConnection())
            {
                SqlCommand deleteCommand = new SqlCommand("spTransfer_delete_PremiumLogin", conn);
                deleteCommand.CommandTimeout = 3600;
                deleteCommand.CommandType = CommandType.StoredProcedure;
                deleteCommand.Parameters.AddWithValue("@fromDT", dateTimeList[0].ToString("yyyy-MM-dd") + " 00:00:00");
                deleteCommand.Parameters.AddWithValue("@toDT", dateTimeList[dateTimeList.Count - 1].ToString("yyyy-MM-dd") + " 23:59:59");
                deleteCommand.ExecuteNonQuery();
            }
            foreach (PremiumLogin item in data)
            {
                try
                {
                    using (SqlConnection conn = ConnectionHelper.GetConnection())
                    {
                        SqlCommand command = new SqlCommand("sp_Insert_PremiumLogin", conn);
                        command.CommandTimeout = 3600;
                        command.CommandType = CommandType.StoredProcedure;
                        command.Parameters.AddWithValue("@datetime", item.DateTime);
                        command.Parameters.AddWithValue("@InventoryAccountSum", item.InventoryAccountSum);
                        command.Parameters.AddWithValue("@ActiveSpendAccountNum", item.ActiveSpendAccountNum);
                        command.Parameters.AddWithValue("@InventoryGoldNum", item.InventoryGoldNum);
                        command.Parameters.AddWithValue("@InventoryScoreCardNum", item.InventoryScoreCardNum);
                        command.Parameters.AddWithValue("@RechargeSum", item.RechargeSum);
                        command.Parameters.AddWithValue("@RechargeSumGosu", item.RechargeSumGosu);
                        command.Parameters.AddWithValue("@GoldSumExchangeFromScoredCard", item.GoldSumExchangeFromScoredCard);
                        command.Parameters.AddWithValue("@UsingGoldNum", item.UsingGoldNum);
                        command.Parameters.AddWithValue("@UsingActualCollect", item.UsingActualCollect);
                        command.Parameters.AddWithValue("@RechardAccountNum", item.RechardAccountNum);
                        command.Parameters.AddWithValue("@NewIncreaseRechardAccountNum", item.NewIncreaseRechardAccountNum);
                        command.Parameters.AddWithValue("@UsingCharacterNum", item.UsingCharacterNum);
                        command.Parameters.AddWithValue("@RechardAccountSum", item.RechardAccountSum);
                        command.Parameters.AddWithValue("@SevenDaySaveAccountNum", item.SevenDaySaveAccountNum);
                        command.Parameters.AddWithValue("@SavePercent", item.SavePercent);
                        command.Parameters.AddWithValue("@NewIncreaseAccountLossSum", item.NewIncreaseAccountLossSum);
                        command.Parameters.AddWithValue("@NewIncreaseAccountLossPercent", item.NewIncreaseAccountLossPercent);
                        command.ExecuteNonQuery();
                    }
                }catch(Exception ex)
                {
 
                }
            }
        }
        public List<PremiumLogin> getFastPremiumLoginData(string from, string to)
        {
            List<PremiumLogin> data = new List<PremiumLogin>();
            using (SqlConnection conn = ConnectionHelper.GetConnection())
            {
                SqlCommand command = new SqlCommand("sp_Select_PremiumLogin", conn);
                command.CommandTimeout = 3600;
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@fromDT", from);
                command.Parameters.AddWithValue("@toDT", to);
                SqlDataReader dataReader = command.ExecuteReader();
                while (dataReader.Read())
                {
                    PremiumLogin pl = new PremiumLogin();
                    pl.Date = dataReader.GetDateTime(0).ToString("dd/MM/yyyy");
                    pl.Ticks = dataReader.GetDateTime(0).Ticks;
                    pl.InventoryAccountSum = dataReader.IsDBNull(1) == true ? string.Empty : dataReader.GetString(1);
                    pl.ActiveSpendAccountNum = dataReader.GetString(2);
                    pl.InventoryGoldNum = dataReader.GetString(3);
                    pl.InventoryScoreCardNum = dataReader.GetString(4);
                    pl.RechargeSum = dataReader.GetString(5);
                    pl.RechargeSumGosu = dataReader["RechargeSumGosu"].ToString();
                    pl.GoldSumExchangeFromScoredCard = dataReader.GetString(6);
                    pl.UsingGoldNum = dataReader.GetString(7);
                    pl.UsingActualCollect = dataReader.GetString(8);
                    pl.RechardAccountNum = dataReader.GetString(9);
                    pl.NewIncreaseRechardAccountNum = dataReader.GetString(10);
                    pl.UsingCharacterNum = dataReader.GetString(11);
                    pl.RechardAccountSum = dataReader.GetString(12);
                    pl.SevenDaySaveAccountNum = dataReader.GetString(13);
                    pl.SavePercent = dataReader.GetString(14);
                    pl.NewIncreaseAccountLossSum = dataReader.GetString(15);
                    pl.NewIncreaseAccountLossPercent = dataReader.GetString(16);
                    data.Add(pl);
                }
                dataReader.Close();
            }
            return data;
        }
    }
}
